//
// Created by fengg on 2020/3/5.
//
#include "APM.h"

LARGE_INTEGER Frequency;
LARGE_INTEGER StartingTime, EndingTime, ElapsedMicroseconds;


void Begin(){

    QueryPerformanceFrequency(&Frequency);
    QueryPerformanceCounter(&StartingTime);

}


void End(){

    QueryPerformanceCounter(&EndingTime);
    ElapsedMicroseconds.QuadPart = EndingTime.QuadPart - StartingTime.QuadPart;
    ElapsedMicroseconds.QuadPart *= 1000;
    ElapsedMicroseconds.QuadPart /= Frequency.QuadPart;

}

LONGLONG GetLastMeasurement(){

    return ElapsedMicroseconds.QuadPart;

}